#include<stdlib.h>
#include<string.h>
#include <stdio.h>  
#include <math.h>
//#include <windows.h>
#include "com_xieshaoping_jni_NativeEntity.h"

JNIEXPORT jstring JNICALL Java_com_xieshaoping_jni_NativeEntity_getNativeMsg(JNIEnv* env, jobject obj)
{
        //打印内容
        char *msg = "正在调用本地本地native方法-windows";
	    printf(msg);
	    //char * 转为jstring
	    jclass strClass = (*env)->FindClass(env, "java/lang/String");
        jmethodID ctorID = (*env)->GetMethodID(env, strClass, "<init>","([BLjava/lang/String;)V");
        jbyteArray bytes = (*env)->NewByteArray(env, strlen(msg));
        (*env)->SetByteArrayRegion(env, bytes, 0, strlen(msg), (jbyte *) msg);
        jstring encoding = (*env)->NewStringUTF(env, "utf-8");
        return (jstring) (*env)->NewObject(env, strClass, ctorID, bytes, encoding);
}
